from flask import Flask,render_template
from datas import datas
from cos import angle
app=Flask(__name__)

@app.route("/")
def index():
    return render_template("demo.html",datas=datas)

@app.route("/tuijian/<int:id>")
def tuijian(id):
    current=datas[id]["feature"]
    arr=[]
    for i in range(len(datas)):
        if (i!=id):
            obj={}
            a=angle(current,datas[i]["feature"])
            obj["angle"]=a
            obj["id"]=i
            arr.append(a)

        def k(v):
            return v["angle"]
        arr.sort(key=k)
        print(arr)

    return arr[:5]

app.run()